-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
audio: add items to AudioResponseFormat enum #382
Conversation
Codecov Report
@@ Coverage Diff @@
## master #382 +/- ##
=======================================
Coverage 95.22% 95.22%
=======================================
Files 17 17
Lines 670 670
=======================================
Hits 638 638
Misses 22 22
Partials 10 10
|
AudioResponseFormatJSON AudioResponseFormat = "json" | ||
AudioResponseFormatText AudioResponseFormat = "text" | ||
AudioResponseFormatSRT AudioResponseFormat = "srt" | ||
AudioResponseFormatVerboseJSON AudioResponseFormat = "verbose_json" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@romazu What format is verbose_json
? If it is json, you may need to add it to the conditions of the function below.
// HasJSONResponse returns true if the response format is JSON.
func (r AudioRequest) HasJSONResponse() bool {
return r.Format == "" || r.Format == AudioResponseFormatJSON
}
Refs:
https://github.com/sashabaranov/go-openai/blob/master/audio.go#L97-L100
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, you are right, it's a json in the following format:
{
"task": "transcribe",
"language": "english",
"duration": 10.0,
"segments": [
{
"id": 0,
"seek": 0,
"start": 0.0,
"end": 10.16,
"text": " Chapter 1 Looming",
"tokens": [
50364,
18874,
502,
6130,
10539,
50872
],
"temperature": 0.0,
"avg_logprob": -0.6817335401262555,
"compression_ratio": 0.68,
"no_speech_prob": 0.01032273843884468,
"transient": false
}
],
"text": "Chapter 1 Looming"
}
I also expanded AudioResponse struct to accommodate for this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the PR! 🙌🏻
Added "text" and "verbose_json" output formats.
See reference:
https://platform.openai.com/docs/api-reference/audio/create